<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理员列表</title>
    <link rel="stylesheet" href="../dist/css/layui.css">
    <!--    <link rel="stylesheet" href="../layui/css/modules/layer/default/layer.css">-->
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">疫情可视化系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="../img/admin2.png" class="layui-nav-img">
                    Admin
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:window.location ='regist.html';">用户注册</a></dd>
                    <dd><a href="javascript:window.location ='login.html';">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:window.location = 'country.html';">全国疫情统计</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:window.location ='guizhou.html';">贵州省</a></dd>
                        <dd><a href="javascript:window.location ='yunnan.html';">云南省</a></dd>
                        <dd><a href="javascript:window.location ='xianggang.html';">香港</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item "><a href="javascript:window.location = 'admin.html';">管理员列表</a></li>
                <li class="layui-nav-item"><a href="javascript:window.location = 'patience.html';">患者信息管理</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!--        &lt;!&ndash; 内容主体区域 &ndash;&gt;-->
        <!--        <div style="padding: 15px;">内容主体区域。记得修改 layui.css 和 js 的路径</div>-->
        <div id="main" style="width: 100%;height: 100%"></div>
    </div>

    <div class="layui-body" align="center">
        <!--中心区域-->
        <table class="layui-hide" id="test" lay-filter="test"></table>
        <!--管理员信息修改弹出框-->
        <div class="layui-row" id="popPatience" style="display:none;">
            <div class="layui-col-md11">
                <form class="layui-form" lay-filter="formTestFilter2121">
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="username" readonly="readonly" placeholder="贵州省"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="email" placeholder="8" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">性别：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sex" placeholder="156" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号状态：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="status" placeholder="156" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="button" class="layui-btn layui-btn-normal" style="width: 200px">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        疫情可视化分析
    </div>
</div>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit" style="background-color: #0000FF">编辑</a>
</script>


<script src="../dist/layui.js" charset="utf-8"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>


<script>
    //JS
    layui.use('table', function () {
        var table = layui.table;

        table.render({
            elem: '#test'
            , url: '/findAll'  //从数据库中获取所有的用户信息的实现接口
            , toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            , defaultToolbar: []
            , cols: [[
                {type: 'checkbox'}
                , {field: 'id', title: 'ID', sort: true, width: 150}
                , {field: 'username', title: '用户名', width: 200}
                , {field: 'email', title: '邮箱', width: 200}
                , {field: 'sex', title: '性别', width: 150}//minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                , {field: 'status', title: '账号状态', width: 150}
                , {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150}
            ]]
            ,done: function (res,curr,count){

                $("[data-field='status']").children().each(function(){
                    if($(this).text()=='0'){
                        $(this).text("账号正常")
                    }else if($(this).text()=='1'){
                        $(this).text("账号异常")
                    }
                });
            }
        });
    });

</script>
</body>
</html>